package com.ssy.lingxi.purchase.api.enums.tender;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 招投标通用状态枚举类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/29
 */
public enum TenderStatusEnum {

    BATCH_CHECK_PASS(1, "批量审核通过"),
    RECEIVE_EVALUATION_NOTICE(2, "接收评标通知"),
    REFUSE_EVALUATION_NOTICE(3, "拒绝评标通知"),
    EVALUATION_NOTICE(4, "评标通知"),
    SEND_EVALUATION_NOTICE(5, "发送评标通知"),
    HAS_SEND_EVALUATION_NOTICE(6, "已发送评标通知"),
    AGAIN_SEND_EVALUATION_NOTICE(7, "再次发送评标通知"),
    HAS_EVALUATION_NOTICE(8, "已评标"),
    WIN_TENDER(9, "待中标公示"),
    SEND_WIN_TENDER(10, "发送中标公示"),
    DEFINE_TENDER(11, "定标"),
    CONFIRM_DEFINE_TENDER(12, "确认定标"),
    FINISH_TENDER(13, "完成招标");

    private Integer code;
    private String message;

    TenderStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        TenderStatusEnum statusEnum = Arrays.stream(TenderStatusEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(TenderStatusEnum.class, statusEnum.getCode());
    }
}
